<script>
	var eg1 = () => {
		async function async1() {
			console.log("1st"); //2
			await async2();
			console.log("1end"); //6
		}
		async function async2() {
			console.log(2); //3
		}
		console.log("script-st"); //1
		setTimeout(function () {
			console.log("set"); //8
		}, 0);
		async1();

		new Promise(function (res) {
			console.log("pro1"); //4
			res();
		}).then(function () {
			console.log("pro2"); //7
		});
		console.log("end"); //5
	};

	// eg1();
	var eg2 = async () => {
		console.log("start");
		const a = await 100;
		console.log("a", a);
		const b = await Promise.resolve(200);
		console.log("b", b);
		const c = await Promise.reject(300);
		console.log("c", c);
		console.log("end");
	};
	eg2(); // start, a,  b
</script>
